from pages.basePage3 import BasePage
from config.setting import host_port

class Elment_Owner(BasePage):
    def __init__(self):
        BasePage.__init__(self)
        self.driver.get(f"http://{host_port}/SharedParkingPlace/property/index.html")
    # 定位层

# 定位用户管理
    def elment_yonghuguanli(self):
        return self.driver.find_element_by_xpath('//div[@id="main"]/div[1]/div[1]/div[1]/div[1]')
# 定位业主方
    def elment_owner(self):
        return self.driver.find_element_by_xpath('//div[@id="_easyui_tree_4"]/span[3]')
# 定位表单
    def elment_biaodan(self):
        a=self.driver.find_element_by_xpath('//div[@id="testIframe"]/div[2]/div[2]/div/iframe')
        return a
# 定位文本框
    def elment_text(self):
        return self.driver.find_element_by_xpath('//*[@id="datagrid-row-r1-2-0"]/td[2]/div')
    # 操作层
class Option_Owner(Elment_Owner):
    def __init__(self):
        Elment_Owner.__init__(self)
    #     点击用户管理
    def click_yonghuguanli(self):
        self.elment_yonghuguanli().click()
        # 点击出租方
    def click_chuzufang(self):
        self.elment_owner().click()
        # 切换表单
    def get_biaodan(self):
        b=self.elment_biaodan()
        return self.driver.switch_to.frame(b)
        # 获取文本框信息
    def text_yemian(self):
         return self.elment_text().text
        # 业务层
class Apply_Owner(Option_Owner):
    def __init__(self):
        Option_Owner.__init__(self)
    def apply_owner01(self):
        self.click_yonghuguanli()
        self.click_chuzufang()
        self.get_biaodan()
        c=self.text_yemian()

        return c
if __name__ == '__main__':
    Apply_Owner().apply_owner01()

